clear all

import excel "lucid.xlsx", sheet("Moral+values+-+Study+2_March+3,") firstrow

merge 1:1 ResponseId using "president code.dta"

set scheme plotplain

*rename
rename WQ age_lucid
rename gender gender_lucid
rename hhi hhi_lucid
rename ethnicity ethn_lucid
rename hispanic hisp_lucid
rename education educ_lucid
rename political_party party_lucid
rename region region_lucid
rename zip zip_lucid

*demos
gen PID=pid
recode PID 1=2 2=6 3/4=4
recode PID 2=1 if pidd==1
recode PID 6=7 if pidr==1
recode PID 4=3 if pidi==1
recode PID 4=5 if pidi==2

recode sex 2/3=0, gen(male)
recode race 1=1 2/5=0, gen(white)

*attention
recode check1 5=1 *=0
rename policy_2 check2
recode check2 4=1 *=0
keep if check1==1 & check2==1 & pres_code=="1"

*values
rename _value value1
rename _mca mca1
rename _mcn mcn1
rename _mcd mcd1
rename AX value2
rename AY mca2
rename AZ mcn2
rename BA mcd2
rename BB value3
rename BC mca3
rename BD mcn3
rename BE mcd3
rename BF value4
rename BG mca4
rename BH mcn4
rename BI mcd4
rename _Q59 value5
rename _Q60 mca5
rename _Q61 mcn5
rename _Q62 mcd5
rename BN value6
rename BO mca6
rename BP mcn6
rename BQ mcd6
rename BR value7
rename BS mca7
rename BT mcn7
rename BU mcd7
rename _Q63 value8
rename _Q64 mca8
rename _Q65 mcn8
rename _Q66 mcd8
rename BZ value9
rename CA mca9
rename CB mcn9
rename CC mcd9
rename CD value10
rename CE mca10
rename CF mcn10
rename CG mcd10
rename CH value11
rename CI mca11
rename CJ mcn11
rename CK mcd11
rename _Q97 value12
rename _Q98 mca12
rename _Q99 mcn12
rename _Q100 mcd12
rename CP value13
rename CQ mca13
rename CR mcn13
rename CS mcd13
rename CT value14
rename CU mca14
rename CV mcn14
rename CW mcd14
rename _Q149 value15
rename _Q150 mca15
rename _Q151 mcn15
rename _Q152 mcd15
rename DB value16
rename DC mca16
rename DD mcn16
rename DE mcd16
rename DF value17
rename DG mca17
rename DH mcn17
rename DI mcd17
rename DJ value18
rename DK mca18
rename DL mcn18
rename DM mcd18
rename DN value19
rename DO mca19
rename DP mcn19
rename DQ mcd19
rename DR value20
rename DS mca20
rename DT mcn20
rename DU mcd20
rename _Q153 value21
rename _Q154 mca21
rename _Q155 mcn21
rename _Q156 mcd21
rename DZ value22
rename EA mca22
rename EB mcn22
rename EC mcd22
rename ED value23
rename EE mca23
rename EF mcn23
rename EG mcd23
rename EH value24
rename EI mca24
rename EJ mcn24
rename EK mcd24
rename _Q157 value25
rename _Q158 mca25
rename _Q159 mcn25
rename _Q160 mcd25
rename EP value26
rename EQ mca26
rename ER mcn26
rename ES mcd26
rename ET value27
rename EU mca27
rename EV mcn27
rename EW mcd27
rename EX value28
rename EY mca28
rename EZ mcn28
rename FA mcd28
rename FB value29
rename FC mca29
rename FD mcn29
rename FE mcd29
rename _Q161 value30
rename _Q162 mca30
rename _Q163 mcn30
rename _Q164 mcd30
rename FJ value31
rename FK mca31
rename FL mcn31
rename FM mcd31
rename FN value32
rename FO mca32
rename FP mcn32
rename FQ mcd32
rename _Q165 value33
rename _Q166 mca33
rename _Q167 mcn33
rename _Q168 mcd33
rename FV value34
rename FW mca34
rename FX mcn34
rename FY mcd34
rename FZ value35
rename GA mca35
rename GB mcn35
rename GC mcd35
rename GD value36
rename GE mca36
rename GF mcn36
rename GG mcd36
rename _Q169 value37
rename _Q170 mca37
rename _Q171 mcn37
rename _Q172 mcd37
rename GL value38
rename GM mca38
rename GN mcn38
rename GO mcd38
rename GP value39
rename GQ mca39
rename GR mcn39
rename GS mcd39
rename GT value40
rename GU mca40
rename GV mcn40
rename GW mcd40
rename _Q173 value41
rename _Q174 mca41
rename _Q175 mcn41
rename _Q176 mcd41
rename HB value42
rename HC mca42
rename HD mcn42
rename HE mcd42
rename HF value43
rename HG mca43
rename HH mcn43
rename HI mcd43
rename HJ value44
rename HK mca44
rename HL mcn44
rename HM mcd44
rename HN value45
rename HO mca45
rename HP mcn45
rename HQ mcd45
rename HR value46
rename HS mca46
rename HT mcn46
rename HU mcd46
rename _Q177 value47
rename _Q178 mca47
rename _Q179 mcn47
rename _Q180 mcd47
rename HZ value48
rename IA mca48
rename IB mcn48
rename IC mcd48
rename ID value49
rename IE mca49
rename IF mcn49
rename IG mcd49
rename IH value50
rename II mca50
rename IJ mcn50
rename IK mcd50
rename IL value51
rename IM mca51
rename IN mcn51
rename IO mcd51
rename IP value52
rename IQ mca52
rename IR mcn52
rename IS mcd52
rename _Q181 value53
rename _Q182 mca53
rename _Q183 mcn53
rename _Q184 mcd53
rename IX value54
rename IY mca54
rename IZ mcn54
rename JA mcd54
rename JB value55
rename JC mca55
rename JD mcn55
rename JE mcd55
rename JF value56
rename JG mca56
rename JH mcn56
rename JI mcd56
rename JJ value57
rename JK mca57
rename JL mcn57
rename JM mcd57
rename JN value58
rename JO mca58
rename JP mcn58
rename JQ mcd58
rename _Q185 value59
rename _Q186 mca59
rename _Q187 mcn59
rename _Q188 mcd59
rename JV value60
rename JW mca60
rename JX mcn60
rename JY mcd60
rename JZ value61
rename KA mca61
rename KB mcn61
rename KC mcd61
rename KD value62
rename KE mca62
rename KF mcn62
rename KG mcd62
rename KH value63
rename KI mca63
rename KJ mcn63
rename KK mcd63
rename KL value64
rename KM mca64
rename KN mcn64
rename KO mcd64
rename _Q189 value65
rename _Q190 mca65
rename _Q191 mcn65
rename _Q192 mcd65
rename KT value66
rename KU mca66
rename KV mcn66
rename KW mcd66
rename KX value67
rename KY mca67
rename KZ mcn67
rename LA mcd67
rename LB value68
rename LC mca68
rename LD mcn68
rename LE mcd68
rename LF value69
rename LG mca69
rename LH mcn69
rename LI mcd69
rename LJ value70
rename LK mca70
rename LL mcn70
rename LM mcd70
rename _Q217 value71
rename _Q218 mca71
rename _Q219 mcn71
rename _Q220 mcd71
rename LR value72
rename LS mca72
rename LT mcn72
rename LU mcd72
rename LV value73
rename LW mca73
rename LX mcn73
rename LY mcd73
rename LZ value74
rename MA mca74
rename MB mcn74
rename MC mcd74
rename MD value75
rename ME mca75
rename MF mcn75
rename MG mcd75
rename MH value76
rename MI mca76
rename MJ mcn76
rename MK mcd76
rename _Q193 value77
rename _Q194 mca77
rename _Q195 mcn77
rename _Q196 mcd77
rename MP value78
rename MQ mca78
rename MR mcn78
rename MS mcd78
rename MT value79
rename MU mca79
rename MV mcn79
rename MW mcd79
rename MX value80
rename MY mca80
rename MZ mcn80
rename NA mcd80
rename NB value81
rename NC mca81
rename ND mcn81
rename NE mcd81
rename NF value82
rename NG mca82
rename NH mcn82
rename NI mcd82
rename NJ value83
rename NK mca83
rename NL mcn83
rename NM mcd83
rename NN value84
rename NO mca84
rename NP mcn84
rename NQ mcd84
rename _Q197 value85
rename _Q198 mca85
rename _Q199 mcn85
rename _Q200 mcd85
rename NV value86
rename NW mca86
rename NX mcn86
rename NY mcd86
rename NZ value87
rename OA mca87
rename OB mcn87
rename OC mcd87
rename OD value88
rename OE mca88
rename OF mcn88
rename OG mcd88
rename OH value89
rename OI mca89
rename OJ mcn89
rename OK mcd89
rename OL value90
rename OM mca90
rename ON mcn90
rename OO mcd90
rename OP value91
rename OQ mca91
rename OR mcn91
rename OS mcd91
rename OT value92
rename OU mca92
rename OV mcn92
rename OW mcd92
rename _Q201 value93
rename _Q202 mca93
rename _Q203 mcn93
rename _Q204 mcd93
rename PB value94
rename PC mca94
rename PD mcn94
rename PE mcd94
rename _Q205 value95
rename _Q206 mca95
rename _Q207 mcn95
rename _Q208 mcd95
rename PJ value96
rename PK mca96
rename PL mcn96
rename PM mcd96
rename _Q209 value97
rename _Q210 mca97
rename _Q211 mcn97
rename _Q212 mcd97
rename PR value98
rename PS mca98
rename PT mcn98
rename PU mcd98
rename PV value99
rename PW mca99
rename PX mcn99
rename PY mcd99
rename PZ value100
rename QA mca100
rename QB mcn100
rename QC mcd100
rename QD value101
rename QE mca101
rename QF mcn101
rename QG mcd101
rename QH value102
rename QI mca102
rename QJ mcn102
rename QK mcd102
rename _Q213 value103
rename _Q214 mca103
rename _Q215 mcn103
rename _Q216 mcd103
rename QP value104
rename QQ mca104
rename QR mcn104
rename QS mcd104
rename QT value105
rename QU mca105
rename QV mcn105
rename QW mcd105
rename QX value106
rename QY mca106
rename QZ mcn106
rename RA mcd106
rename RB value107
rename RC mca107
rename RD mcn107
rename RE mcd107
rename RF value108
rename RG mca108
rename RH mcn108
rename RI mcd108

*recode reversed value statements
recode value79 1=5 2=4 4=2 5=1
recode value80 1=5 2=4 4=2 5=1
recode value83 1=5 2=4 4=2 5=1
recode value84 1=5 2=4 4=2 5=1
recode value86 1=5 2=4 4=2 5=1
recode value88 1=5 2=4 4=2 5=1
recode value90 1=5 2=4 4=2 5=1
recode value92 1=5 2=4 4=2 5=1
recode value98 1=5 2=4 4=2 5=1
recode value100 1=5 2=4 4=2 5=1
recode value101 1=5 2=4 4=2 5=1
recode value104 1=5 2=4 4=2 5=1
recode value105 1=5 2=4 4=2 5=1
recode value108 1=5 2=4 4=2 5=1

*combining mc questions, trichotomizing value agreement
forval x=1/108 {
	egen mc`x'=rowfirst(mca`x' mcn`x' mcd`x')
	recode value`x' 1/2=1 3=0 4/5=-1, gen(valuetri`x')
	recode value`x' 1=5 2=4 4=2 5=1
}
drop mcn* mca* mcd*

* descriptive stats: Table A2 in OA
tabstat PID male white age educ, stat(min max mean sd N) col(stat)

** reshaping **
gen RespID=_n
reshape long value valuetri mc, i(RespID) j(item)
rename value support
rename valuetri supportri

gen typology=.
replace typology=1 if item<=40
replace typology=2 if item>40 & item<77
replace typology=3 if item>=77

gen value=.
*labeling value systems
replace value=1 if item<5
replace value=2 if item>4 & item<8
replace value=3 if item>=8 & item<=11
replace value=4 if item>=12 & item<=14
replace value=5 if item>=15 & item<=20
replace value=6 if item>=21 & item<=24
replace value=7 if item>=25 & item<=29
replace value=8 if item>=30 & item<=32
replace value=9 if item>=33 & item<=36
replace value=10 if item>=37 & item<=40

*mfq
replace value=11 if item>40 & item<47
replace value=12 if item>46 & item<53
replace value=13 if item>52 & item<59
replace value=14 if item>58 & item<65
replace value=15 if item>64 & item<71
replace value=16 if item>70 & item<77

*political
replace value=17 if item>=77 & item<=84
replace value=18 if item>=85 & item<=92
replace value=19 if item>=93 & item<=94
replace value=20 if item>=95 & item<=96
replace value=21 if item>=97 & item<=102
replace value=22 if item>=103 & item<=108

label define valuel 1 "S: Self-Direction" 2 "S: Hedonism" 3 "S: Benevolence" 4 "S: Power" 5 "S: Universalism" 6 "S: Achievement" 7 "S: Security" 8 "S: Stimulation" 9 "S: Conformity" 10 "S: Tradition" 11 "MF: Care" 12 "MF: Fairness" 13 "MF: Loyalty" 14 "MF: Authority" 15 "MF: Sanctity" 16 "MF: Proportionality" 17 "P: Equality" 18 "P: Humanitarianism" 19 "P: Moral Traditionalism" 20 "P: Moral Tolerance" 21 "P: Individualism" 22 "P: Limited Gov't"
label values value valuel

label define typologyl 1 "Schwartz" 2 "MFT" 3 "Political", replace
label values typology typologyl

* typology: Figure A2 in OA and model 2 of Table D1 in Dataverse

mixed mc ibn.typology if support>3 & value!=16, nocons || RespID:
est store t1
test 2.typology=3.typology
test 2.typology=1.typology
test 1.typology=3.typology
coefplot t1, keep(*typology) xlab(3.25(.25)4.25) order(1.typology 3.typology 2.typology) xtitle("Moralization") saving(typology_lucid.gph, replace) legend(off) 

* values: Figure A3 in OA and model 2 of Table D2 in Dataverse

mixed mc ibn.value if support>3 & value!=16, nocons || RespID:
est store v1
* benevolence vs. care/fairness
test 3.value=11.value
test 3.value=12.value
* universalism vs. care/fairness
test 5.value=11.value
test 5.value=12.value
* conformity vs. sanctity
test 9.value=15.value
* tradition vs. loyalty/authority
test 10.value=13.value
test 10.value=14.value
* equality vs. fairness
test 17.value=12.value
* humanitarianism vs. fairness
test 18.value=12.value
* moral traditionalism vs. sanctity
test 19.value=15.value
* moral tolerance vs. sanctity
test 20.value=15.value
* achievement vs. authority
test 6.value=14.value
* self direction vs. authority
test 1.value=14.value

gen valcoef=.
gen valse=.
forval x=1/15{
replace valcoef = _b[`x'.value] in `x'
replace valse=_se[`x'.value] in `x'
}
forval x=17/22{
replace valcoef = _b[`x'.value] in `x'
replace valse=_se[`x'.value] in `x'
}

coefplot v1, keep(*value) xlab(2(.5)5) order(4.value 8.value 6.value 2.value 1.value 7.value 10.value 3.value 5.value 9.value 21.value 22.value 20.value 17.value 19.value 18.value 14.value 13.value 15.value 12.value 11.value) subtitle("Lucid Sample") xtitle("Moralization") saving(value_lucid.gph, replace)

drop if valcoef==.
gen val = _n

drop _merge
merge 1:1 val using "comparing samples.dta"
cor valcoef valcoefmturk
